package autoload

import (
	"blog/core"
	"blog/core/db"
)

type Db struct {
}

func (rev *Db) Init() {
	db2 := db.Create(core.Config.Db.Drive)
	db2.Name(core.Config.Db.Name).Prefix(core.Config.Db.Prefix).UserName(core.Config.Db.UserName).Password(core.Config.Db.Password).Password(core.Config.Db.Password).Port(core.Config.Db.Port).Host(core.Config.Db.Host).Run()
	core.DB = db2
	if core.Config.Debug {
		core.DbConnect = db2.GetConnect().Debug()
	} else {
		core.DbConnect = db2.GetConnect()
	}
}
